//
//  DetailGenderViewController.m
//  Beauty
//
//  Created by Snow on 16/9/8.
//  Copyright © 2016年 Snow. All rights reserved.
//

#import "DetailGenderViewController.h"
#import "GXMacro.h"
@interface DetailGenderViewController ()
@property (nonatomic, strong) UIButton *buttonOfMan;
@property (nonatomic, strong) UIButton *buttonOfWomen;
@property (nonatomic, assign) NSInteger countOfMan;
@property (nonatomic, assign) NSInteger countOfWomne;
@end

@implementation DetailGenderViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _countOfMan = 1;
    _countOfWomne = 1;
    self.buttonOfMan = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonOfWomen = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.view addSubview:self.buttonOfMan];
    [self.view addSubview:self.buttonOfWomen];
    
    [self.buttonOfMan mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.view.mas_left).mas_equalTo(50);
        make.centerY.mas_equalTo(self.view.mas_centerY);
        make.height.mas_equalTo(100);
        make.width.mas_equalTo(100);
    }];
    
    [self.buttonOfWomen mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.view.mas_right).mas_equalTo(-50);
        make.centerY.mas_equalTo(self.view.mas_centerY);
        make.height.mas_equalTo(100);
        make.width.mas_equalTo(100);
    }];
    
    [self.buttonOfMan setImage:[UIImage imageNamed:@"man"] forState:UIControlStateNormal];
    [self.buttonOfWomen setImage:[UIImage imageNamed:@"women"] forState:UIControlStateNormal];
    [self.buttonOfMan addTarget:self action:@selector(handleMan:) forControlEvents:UIControlEventTouchUpInside];
    [self.buttonOfWomen addTarget:self action:@selector(handleWomen:) forControlEvents:UIControlEventTouchUpInside];
}
- (void)handleMan:(UIButton *)button
{
    _countOfMan++;
    if (_countOfMan % 2 == 0) {
        [_buttonOfMan setImage:[UIImage imageNamed:@"choseMan"] forState:UIControlStateNormal];
        [_buttonOfWomen setImage:[UIImage imageNamed:@"women"] forState:UIControlStateNormal];
        _countOfWomne = 1;
    } else {
    [_buttonOfMan setImage:[UIImage imageNamed:@"man"] forState:UIControlStateNormal];
        }
}
- (void)handleWomen:(UIButton *)button
{
    _countOfWomne++;
    if (_countOfWomne % 2 == 0) {
        [_buttonOfWomen setImage:[UIImage imageNamed:@"choseWomen"] forState:UIControlStateNormal];
        [_buttonOfMan setImage:[UIImage imageNamed:@"man"] forState:UIControlStateNormal];
        _countOfMan = 1;
    } else {
        [_buttonOfWomen setImage:[UIImage imageNamed:@"women"] forState:UIControlStateNormal];
    }

}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
